Import('env')

env.Append(DPATH=['#source', '#source/app'])

# OS-specific
if env['PLATFORM'] == 'darwin':
    if env['DC'] == 'dmd':
        env.Append(DLINKFLAGS=['-L-framework', '-LFoundation', '-L-framework', '-LImageIO'])
    elif env['DC'] == 'ldc' or env['DC'] == 'ldc2':
        # NOTE: LDC's support for Objective-C "is seriously lacking".
        #       The below *should* work when it's better supported.
        # SEE: https://github.com/ldc-developers/ldc/issues/3907
        env.Append(DLINKFLAGS=['-L-framework', '-LFoundation', '-L-framework', '-LImageIO'])


mlib_files = SConscript('mlib/SConscript', exports='env')
pd_files = SConscript('pd/SConscript', exports='env')
pixiv_down_files = SConscript('app/SConscript', exports='env')

env.Program('pixiv_down',
    mlib_files + pd_files + pixiv_down_files
)

env.Install(env['bindir'], 'pixiv_down')

SConscript('plugins/SConscript', exports='env')
